Skip to content

Conversation

@narrieta
Copy link
Member

Added a periodic report of the status of the firewall rules.

Also, if the status is incorrect, we use a "verbose" mode where all the commands related to the firewall are logged, along with their output.

narrieta@microsoft added 2 commits December 31, 2025 14:48
OK = "OK" # The firewall rules for the WireServer are setup correctly
NotSet = "NotSet" # The firewall rules have not been set
Invalid = "Invalid" # The state of the firewall rules is not as expected, e.g. because some rules are missing
Inconsistent = "Inconsistent" # The stare of the firewall is reported differently by different tools, e.g. "iptables -C" vs "iptables -L"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: state

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks; fixed

self._firewall_manager = None # initialized on demand in the _operation method
self._message_count = 0
self._report_after = datetime.datetime.now(UTC)
self._firewall_state = FirewallState.OK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we initialize to Unknown state since it hasn't been ch.cked yet?

class FirewallState(object):
    ...
    Unknown = "Unknown"  # The state of the firewall has not been checked yet

Copy link
Member Author

@narrieta narrieta Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initialized it to OK to avoid turning on verbose mode in the first iteration:

self._firewall_manager.verbose = self._firewall_state != FirewallState.OK and self._should_report

I can add a comment to that respect in the initialization

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel first iteration may be critical given the existing duplicate cases we have seen so far, where env thread sees different result first time than we expected

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the initial setup is verbose, the initial periodic check is not - if the condition persists, the 2nd iteration of the env thread should produce verbose output

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieford - added comment

@narrieta narrieta merged commit 41be93f into Azure:release-2.15.1.0 Jan 6, 2026
12 checks passed
@narrieta narrieta deleted the firewall-telemetry branch January 6, 2026 17:44
narrieta added a commit to narrieta/WALinuxAgent that referenced this pull request Jan 6, 2026
narrieta added a commit that referenced this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants